package com.xmindguoguo.boot.core.beetl;

import java.util.List;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.xmindguoguo.boot.modular.system.model.TSystemDictModel;
import com.xmindguoguo.boot.modular.system.service.ITSystemDictService;
import com.xmindguoguo.boot.util.spring.SpringContextHolder;

/**
 * beetl 数据字典辅助工具类
 * 
 * @ClassName DictUtil
 * @author <a href="892042158@qq.com" target="_blank">于国帅</a>
 * @date 2019年2月15日 下午10:50:28
 *
 */
public class DictUtil {
    private ITSystemDictService systemDictService = SpringContextHolder.getBean(ITSystemDictService.class);

    public TSystemDictModel selectById(String id) {
        return systemDictService.selectById(id);
    }

    public TSystemDictModel selectOne(String pId, Integer dictValue) {
        Wrapper<TSystemDictModel> wrapper = new EntityWrapper<>();
        wrapper.eq("pid", pId);
        wrapper.eq("dictValue", dictValue);
        return systemDictService.selectOne(wrapper);
    }

    public List<TSystemDictModel> selectList(String pId) {
        Wrapper<TSystemDictModel> wrapper = new EntityWrapper<>();
        wrapper.eq("pid", pId);
        return systemDictService.selectList(wrapper);
    }
}
